home *** CD-ROM | disk | FTP | other *** search
- // Copyright 1999 Macromedia, Inc. All rights reserved.
-
- // *********** GLOBAL VARS *****************************
-
- var helpDoc = MM.HELP_inspSsiCommon;
-
- // ******************** API ****************************
-
-
- function canInspectSelection()
- {
-
- var curSelection = dreamweaver.getSelection();
- var includeStr;
- var tempStr;
- var theObj = dreamweaver.offsetsToNode(curSelection[0],curSelection[1]);
-
-
- if (theObj.nodeType == Node.COMMENT_NODE)
- {
- tempStr = theObj.data;
- includeStr = tempStr.toLowerCase().indexOf("#include");
-
- if (includeStr != -1)
- {
- return "true";
- }
- else
- {
- return "false";
- }
- }
- else
- {
- return "false";
- }
- }
- function inspectSelection()
- {
- var result = dreamweaver.getSelection();
- var theObj = dreamweaver.offsetsToNode(result[0],result[1]);
- var fileStr,virtualStr,quoteStr,tempStr,includeStr,quoteStrLast;
- if (theObj.nodeType != Node.COMMENT_NODE)
- return;
-
- tempStr = theObj.data;
- fileStr = tempStr.toLowerCase().indexOf("file");
- virtualStr = tempStr.toLowerCase().indexOf("virtual");
- quoteStr = tempStr.indexOf('"');
- quoteStrLast = tempStr.lastIndexOf('"');
- includeStr = tempStr.toLowerCase().indexOf("#include");
- var fileRadObj = findObject("radioFile");
- var virtualRadObj = findObject("radioVirtual");
- gOrignalURL = tempStr.substring(quoteStr+1,quoteStrLast);
- findObject("editField").value = gOrignalURL;
-
- gOrignalRadio = ssiType( tempStr.toLowerCase() );
- if ( gOrignalRadio == "virtual" )
- {
- virtualRadObj.checked = true;
- fileRadObj.checked = false;
- }
- else
- {
- fileRadObj.checked = true;
- virtualRadObj.checked = false;
- }
-
- }
-
- // whichButton is 0 for no button clicked, 1 for the virtual button,
- // 2 for the file button
- function setComment(whichButton)
- {
- var result = dreamweaver.getSelection();
- var theObj = dreamweaver.offsetsToNode(result[0],result[1]);
-
- if (theObj.nodeType != Node.COMMENT_NODE)
- return;
-
- tempStr = theObj.data;
- var radioStr;
- var fileRadObj = findObject("radioFile");
- var virtualRadObj = findObject("radioVirtual");
- if (whichButton == 1)
- {
- // virtual button was checked
- fileRadObj.checked = false;
- virtualRadObj.checked = true;
- }
- else if (whichButton == 2)
- {
- // file button was checked
- virtualRadObj.checked = false;
- fileRadObj.checked = true;
- }
-
- var URL = findObject("editField").value;
- if (fileRadObj.checked)
- {
- // verify that it's okay as a file-type URL
-
-
- radioStr = "file";
- if (URL.charAt(0) == '/' || URL.indexOf("../") != -1)
- {
- var fileURL;
-
- relativeURL = findObject("editField").value;
- fileURL = virtualToFile(relativeURL);
-
- if ( fileURL == "" )
- {
- radioStr = "virtual";
- virtualRadObj.checked = true;
- fileRadObj.checked = false;
- return;
- }
- else
- {
- URL = fileURL;
- findObject("editField").value = fileURL;
- }
-
- }
-
- // file button was checked
- virtualRadObj.checked = false;
- fileRadObj.checked = true;
- }
- else
- {
- radioStr = "virtual";
- virtualRadObj.checked = true;
- fileRadObj.checked = false;
- }
-
- if ( unchanged( radioStr, URL ) )
- return;
-
- theObj.data = "#include " + radioStr + "=" + '"' + URL + '" ';
-
- }
-
-